home *** CD-ROM | disk | FTP | other *** search
- ;Sound Effect Demo
- ;-----------------
- ;This is a simple demo that plays a sound effect. You have to supply your
- ;own IFF sound at the end of this file.
- ;
- ;Press LMB to play the sound.
- ;Press RMB to exit the demo.
-
- opt o+
-
- INCLUDE "exec/exec_lib.i"
- INCLUDE "games/games_lib.i"
- INCLUDE "games/games.i
-
- CALL MACRO
- jsr _LVO\1(a6)
- ENDM
-
- SECTION "Sound",CODE
-
- ;==========================================================================;
- ; INITIALISE DEMO
- ;==========================================================================;
-
- Start: MOVEM.L A0-A6/D1-D7,-(SP)
- move.l ($4).w,a6
- lea GMS_Name(pc),a1
- moveq #$00,d0
- CALL OpenLibrary
- move.l d0,GMS_Base
- beq Quit
-
- move.l GMS_Base(pc),a6
- CALL AllocAudio
- tst.w d0
- bne.s AudioError
-
- lea Sound_Gong(pc),a0
- CALL InitSound
- tst.w d0
- bne.s ReturnToDOS
-
- ;==========================================================================;
-
- ;==========================================================================;
-
- MainLoop:
- move.l GMS_Base(pc),a6
- CALL Wait_OSVBL
-
- moveq #JPORT1,d0
- CALL Read_Mouse
- btst #MB_RMB,d0
- bne.s ReturnToDOS
- btst #MB_LMB,d0
- beq.s MainLoop
-
- lea Sound_Gong(pc),a0
- CALL PlaySoundPri
- addq.w #2,SAM_Octave(a0)
- cmp.w #OCT_A4,SAM_Octave(a0)
- blt.s .release
- move.w #OCT_G0S,SAM_Octave(a0)
-
- .release
- moveq #JPORT1,d0
- CALL Read_Mouse
- btst #MB_LMB,d0
- bne.s .release
- bra.s MainLoop
-
- ;===========================================================================;
- ; RETURN TO DOS
- ;===========================================================================;
-
- ReturnToDOS:
- move.l GMS_Base(pc),a6
- lea Sound_Gong(pc),a0
- CALL FreeSound
- CALL FreeAudio
- AudioError:
- move.l GMS_Base(pc),a1
- move.l ($4).w,a6
- CALL CloseLibrary
- Quit MOVEM.L (SP)+,A0-A6/D1-D7
- moveq #$00,d0
- rts
-
- ;===========================================================================;
- ; DATA
- ;===========================================================================;
-
- GMS_Name:
- dc.b "games.library",0
- even
- GMS_Base:
- dc.l 0
-
- AMT_PLANES = 1
-
- ScreenStruct:
- dc.l "GSV1",0
- dc.l 0,0,0 ;Screen_Mem1/2/3
- dc.l 0 ;Screen link.
- dc.l Palette ;Address of screen palette.
- dc.l 0 ;Address of rasterlist.
- dc.l 4 ;Amt of colours in palette.
- dc.w 320,256,320,256 ;Screen & Pic Height/Width.
- dc.w AMT_PLANES ;Amt_Planes
- dc.w 0,0 ;Top Of Screen, X/Y
- dc.w 0,0 ;X/Y counters (for scrolling).
- dc.l 0 ;Special attributes.
- dc.w LORES ;Screen mode.
- dc.b INTERLEAVED ;Screen type
- dc.b 0 ;Reserved
- even
-
- Palette dc.w $0000,$0DDD,$0666,$0222
-
- Sound_Gong:
- dc.l "SMV1",0 ;Structure version.
- dc.w CHANNEL_ALL ;Channel to play through.
- dc.w 1 ;Priority.
- dc.l 0 ;Sample header
- dc.l 0 ;Sample address.
- dc.l 0 ;Sample length.
- dc.w OCT_C0S ;Sample period.
- dc.w 100 ;Sample volume.
- dc.l 0 ;Sound attributes.
- dc.l Gong ;Sound file.
-
- Gong: dc.b "GAMESLIB:data/IFF.Lightning",0
- even
-
-